import json
import os



# ========= env
def rank0_print(*args):
    if int(os.environ.get("LOCAL_RANK")) == 0:
        print(*args)



# ========= file
def read_json(file_path):
    with open(file_path, "r", encoding="utf-8") as f:
        return json.load(f)


# ========= dataset
def get_api_pool():
    # TODO
    return []
    # data = read_json("/home/algorithm/yzy/function_call/data_maker/InifiniMath/data/functioncall/api.json")
    # api_pool = {}
    # for item in data:
    #     for api in item["apis"]:
    #         api_pool[api["name"]] = api
    # return api_pool

def apis2str(apis):
    out = []
    for api in apis:
        out.append(json.dumps(api, ensure_ascii=False, indent=4))
    return "\n\n".join(out)
